You are here: Statements and Functions > Write
Syntax samples
WRITE <file ID>, <string or numeric expression>
{,<maximum digits before decimal>,
<digits after decimal>}
Writes information to a general write file. The next item written to the file will appear immediately after this item. WRITE always appends to the file unless the file is RESET. This holds true for multiple replications as well as single, independent runs. Any file that is written to with WRITE automatically becomes a text file and will have an end of file marker attached automatically to the end when it is closed. For more flexible WRITE capability, use XWRITE.
WRITE and WRITELINE automatically separate values by commas
Any logic.
Components
<file ID>
The name of the file as previously defined in the External Files Editor.
<string or numeric expression>
The string or numeric expression to be written to the file. In the output file, quotes will automatically be added to string expressions so that most spreadsheet programs can easily read the file.
<maximum digits before decimal>
The maximum number of digits before the decimal. This value is used to line up any numeric values into columns on the decimal point. This value may be any numeric expression.
<digits after decimal>
The number of spaces to save after the decimal point. Use this option to line up any labels appearing after numbers.
Example
The following example uses both WRITE and WRITELINE to record the time when EntA completes processing at Loc1 in a general write file called Rpt.
Process Table
Entity |
Location |
Operation (min) |
---|---|---|
EntA |
Loc1 |
WAIT N(7.3,.4) WRITE Rpt,"EntA Complete at:" WRITELINE, Rpt CLOCK(min),3,2 |
Routing Table
Blk |
Output |
Destination |
Rule |
Move Logic |
---|---|---|---|---|
|
|
|
|
|
XWRITE, WRITELINE, RESET, READ, and FORMAT(). Also see External Files.
Please note
The sum of the maximum digits before and after the decimal must be less than 20.